package com.yunze.system.service.impl.yunze.install;

import com.yunze.common.mapper.mysql.install.YzInstallPlacefloorMapper;
import com.yunze.common.utils.yunze.PageUtil;
import com.yunze.system.service.yunze.install.YzInstallPlacefloorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class YzInstallPlacefloorServiceImpl implements YzInstallPlacefloorService {

    @Resource
    private YzInstallPlacefloorMapper yzInstallPlacefloorMapper;

    @Override
    public Map<String, Object> PstrMap(Map map) {
        Map<String, Object> omp=new HashMap<String, Object>();
        Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0;
        Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10;
        Integer rowCount = yzInstallPlacefloorMapper.selMapCount(map);
        rowCount=rowCount!=null?rowCount:0;
        PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类
        //数据打包
        map.put("StarRow", pu.getStarRow());
        map.put("PageSize", pu.getPageSize());
        omp.put("Pu", pu);
        omp.put("Data", yzInstallPlacefloorMapper.selMap(map));
        return omp;
    }

    @Override
    public List<Map<String, Object>> libigst() {
        return yzInstallPlacefloorMapper.libigst();
    }

    @Override
    public boolean add(Map map) {
        return yzInstallPlacefloorMapper.add(map)>0;
    }

    @Override
    public boolean upd(Map map) {
        return yzInstallPlacefloorMapper.upd(map)>0;
    }

    @Override
    public boolean del(Map map) {
        return yzInstallPlacefloorMapper.del(map)>0;
    }

    @Override
    public boolean floor(Map map) {
        boolean bool = false;
        String Str = map.get("y_floor").toString();
        List<Map<String,Object>> list = yzInstallPlacefloorMapper.floor(map);
        for (Map<String,Object> Ramp : list){
            String floor = Ramp.get("y_floor").toString();
            if(floor.equals(Str)){
                bool = true;
                break;
            }else {
                bool = false;
            }
        }
        return bool;
    }
}


















